export default function(attrString){
    if(attrString === undefined){
        return [];
    }
    attrString=attrString.trim()
    var isYinhao = false;
    var point = 0;
    var result =[];
    for (let i = 0; i < attrString.length; i++) {
        let char = attrString[i];
        if(char==='"'){
            isYinhao = !isYinhao;
        }else if(char===" "&& !isYinhao){
            if(!/^\s+$/.test(attrString.substring(point,i))){
                result.push(attrString.substring(point,i).trim())
                point = i;
            }
        }
    }
    result.push(attrString.substring(point).trim())
    result = result.map(item=>{
        const o = item.match(/^(.+)=(.+)$/)
        if(o){
            return{
               "name": o[1],
               "value":o[2]
            }
        }
    })
    return result;
}